<template>
  <div>
    <FilterTable
      ref="table"
      :columns="columns"
      :fetchapi="fetchApi"
      :params="fetchParams"
      columnsRef="partPartPurchasePurchaseOrderCheckPurchaseOrderInfo"
      :datakey="'rows'"
      :isSelectColumn="false"
      :onColumnsChange="columns => (this.columns = columns)"
    />
  </div>
</template>
<script>
import { dictionary } from '@/utils/dictMixin';
import { getPurchaseOrderInfo } from '@/api/part/partPurchase/purchaseOrderCheck';
export default {
  name: 'purchaseOrderInfo',
  mixins: [dictionary],
  props: ['id'],
  data() {
    return {
      columns: this.createTableColumns(),
      fetchApi: getOrder,
      fetchParams: { xhrAbort: false }
    };
  },
  methods: {
    createTableColumns() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '单据编号',
          dataIndex: 'orderNo',
          render: props => {
            return <span>{props.row.orderNo}</span>;
          }
        },
        {
          title: '业务类型',
          dataIndex: 'businessTyped',
          render: props => {
            return <span>{props.row.businessTyped}</span>;
          }
        },
        {
          title: '网点名称',
          dataIndex: 'websiteName',
          render: props => {
            return <span>{props.row.websiteName}</span>;
          }
        },
        {
          title: '网点代码',
          dataIndex: 'websiteCode',
          render: props => {
            return <span>{props.row.websiteCode}</span>;
          }
        },
        {
          title: '仓库名称',
          dataIndex: 'storageName',
          hidden: true,
          render: props => {
            return <span>{props.row.storageName}</span>;
          }
        },
        {
          title: '仓库代码',
          dataIndex: 'storageCode',
          hidden: true,
          render: props => {
            return <span>{props.row.storageCode}</span>;
          }
        },
        {
          title: '状态',
          dataIndex: 'orderStatus',
          render: props => {
            return <span>{props.row.orderStatus}</span>;
          }
        },
        {
          title: '提货方式',
          dataIndex: 'transportWayName',
          render: props => {
            return <span>{props.row.transportWayName}</span>;
            1;
          }
        },
        {
          title: '收货人',
          dataIndex: 'consignee',
          render: props => {
            return <span>{props.row.consignee}</span>;
          }
        },
        {
          title: '价格策略',
          dataIndex: 'priceStrategyName',
          render: props => {
            return <span>{props.row.priceStrategyName}</span>;
            1;
          }
        },
        {
          title: '销售域',
          dataIndex: 'salesDmainName',
          render: props => {
            return <span>{props.row.salesDmainName}</span>;
          }
        },
        {
          title: '单据类型',
          dataIndex: 'orderTypeName',
          render: props => {
            return <span>{props.row.orderTypeName}</span>;
          }
        },
        {
          title: '信用账户',
          dataIndex: 'creditAccountName',
          render: props => {
            return <span>{props.row.creditAccountName}</span>;
          }
        },
        {
          title: '税率',
          dataIndex: 'tax',
          render: props => {
            return <span>{props.row.tax}</span>;
          }
        },
        {
          title: '提交日期',
          dataIndex: 'reportDate',
          filterType: 'date-range',
          width: 150,
          dateFormat: 'yyyy-MM-dd HH:mm:ss',
          render: props => {
            return <span>{props.row.reportDate}</span>;
          }
        },
        {
          title: '联系人',
          dataIndex: 'contact',
          render: props => {
            return <span>{props.row.contact}</span>;
          }
        },
        {
          title: '电话',
          dataIndex: 'phone',
          render: props => {
            return <span>{props.row.phone}</span>;
          }
        },
        {
          title: '手机',
          dataIndex: 'mobilePhone',
          render: props => {
            return <span>{props.row.mobilePhone}</span>;
          }
        },
        {
          title: '操作员',
          dataIndex: 'operaorName',
          render: props => {
            return <span>{props.row.operaorName}</span>;
          }
        },
        {
          title: '操作日期',
          dataIndex: 'createdAt',
          filterType: 'date-range',
          width: 150,
          dateFormat: 'yyyy-MM-dd HH:mm:ss',
          render: props => {
            return <span>{props.row.createdAt}</span>;
          }
        },
        {
          title: '货币名称',
          dataIndex: '1',
          initialValue: '人民币'
        },
        {
          title: '地址',
          dataIndex: 'address',
          showOverflowTooltip: true,
          render: props => {
            return <span>{props.row.address}</span>;
          }
        }
      ];
    },
    async getOrder() {
      await getPurchaseOrderInfo(this.id);
    }
  }
};
</script>
